<?
set_time_limit(900);
ignore_user_abort(true);
error_reporting(1); // 1 = Errors only

// Verifica se foi passada alguma acao
if(!isset($_REQUEST['requisicao']))
	exit();

$requisicao = preg_replace('!s:(\d+):"(.*?)";!e', "'s:'.strlen('$2').':\"$2\";'", $_REQUEST['requisicao']);
$requisicao = unserialize(stripslashes($requisicao));

if(!isset($requisicao['cod_site']))
	exit();
define("AW_COD_SITE",intval($requisicao['cod_site']));

// Carrega classe para ler XMLs
if($_SERVER['SERVER_NAME'] == "access.agenciaits.com.br"){
	include_once("/home/httpd/vhosts/agenciaits.com.br/subdomains/access/httpdocs/LIB/minixml/minixml.inc.php");
}
else{
	include_once("../LIB/minixml/minixml.inc.php");
}

include_once("../admin/includes/classes/xml.class.php");
$OBXml = new Xml;

// Carrega classe para ler configuracoes
include_once("../admin/includes/classes/conf.class.php");
$OBConf = new Conf();
$OBConf->carrega_arquivo("../admin/includes/confs/main.conf.xml");

// Inicia Main
include_once(AW_FS_LIB."/adodb/adodb.inc.php");
include_once(AW_FS_INCLUDES."/classes/main.class.php");
include_once(AW_FS_INCLUDES."/classes/main.materia.class.php");$OBMateria = new Materia();
include_once(AW_FS_INCLUDES."/classes/main.tipomateria.class.php");$OBTipoMateria = new TipoMateria();
include_once(AW_FS_INCLUDES."/classes/main.usuario.class.php");$OBUsuario = new Usuario();
include_once(AW_FS_INCLUDES."/classes/main.secao.class.php");$OBSecao = new Secao();
include_once(AW_FS_INCLUDES."/classes/main.site.class.php");$OBSite = new Site();
include_once(AW_FS_INCLUDES."/classes/main.tipopagina.class.php");$OBTipoPagina = new TipoPagina();
include_once(AW_FS_INCLUDES."/classes/main.pagina.class.php");$OBPagina = new Pagina();
include_once(AW_FS_INCLUDES."/classes/main.imagem.class.php");$OBImagem = new Imagem();
include_once(AW_FS_INCLUDES."/classes/main.pessoa.class.php");$OBPessoa = new Pessoa();
include_once(AW_FS_INCLUDES."/classes/main.arquivo.class.php");$OBArquivo = new Arquivo();
include_once(AW_FS_INCLUDES."/classes/main.busca.class.php");$OBBusca = new Busca();
include_once(AW_FS_INCLUDES."/classes/main.colaboracao.class.php");$OBColaboracao = new Colaboracao();
include_once(AW_FS_INCLUDES."/classes/main.dadocolaboracao.class.php");$OBDadoColaboracao = new DadoColaboracao();

include_once(AW_FS_LIB."/smarty-light/src/class.template.php");
$smarty = new template();
$smarty->template_dir = AW_FS_TEMPLATES;
$smarty->compile_dir = AW_FS_TEMPLATES_COMPILED;
$smarty->force_compile = true;
$smarty->assign("layout","default");

define("AW_DEBUG",true);

$site = $OBSite->obtem("cod_site = '".AW_COD_SITE."'");
$site = $site[0];
$OBConf->carrega($site['xmldata_site']);
$site['xmldata_site'] = $OBXml->le($site['xmldata_site']);
$smarty->assign("site",$site);
$smarty->assign("site_url_root",AW_SITE_URL_ROOT);

$site_smarty = new template();
$site_smarty->template_dir = AW_SITE_FS_TEMPLATES;
$site_smarty->compile_dir = AW_SITE_FS_TEMPLATES_COMPILED;
$site_smarty->force_compile = true;
$site_smarty->assign("site",$site);
$site_smarty->assign("site_url_root",AW_SITE_URL_ROOT);

if(!defined("AW_SITE_FS_FILE_EXTENSION"))
	define("AW_SITE_FS_FILE_EXTENSION","shtml");
?>